<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui">
	<f:metadata>
		<f:event type="preRenderView" listener="#{bmeWfmReceiptMB.initwfm}" />
	</f:metadata>
	
	<p:commandButton value="发货单签收..." type="button" onclick="PF('dlgWfmPurch').show();" />
	
	<p:dialog header="发货单签收" widgetVar="dlgWfmPurch" modal="true"  appendTo="@(body)"  
		dynamic="true" closeOnEscape="true"  height="500" width="1280" >
	<h:form id="dlgFrm">
	<p:growl id="msgs" showDetail="true" />
	<p:panel header="发货单信息" style="margin-bottom:5px">
		<h:panelGrid columns="10" cellspacing="10" >
			<p:outputLabel value="合同ID" />
			<p:inputText value="#{bmeWfmReceiptMB.io.bmeContract.id}" disabled="true" />				
			<p:outputLabel value="合同名称" />
			<p:inputText value="#{bmeWfmReceiptMB.io.bmeContract.name}" disabled="true" />
			<p:outputLabel value="订单编号" />
			<p:inputText value="#{bmeWfmReceiptMB.io.bmePurchOrder.id}" disabled="true" />
			<p:outputLabel value="发货单编号" />
			<p:inputText value="#{bmeWfmReceiptMB.io.id}" disabled="true" />
	
			<p:outputLabel value="发货日期" />
			<p:calendar id="signDate" locale="zh" navigator="true" disabled="true"
				value="#{bmeWfmReceiptMB.io.sendDate}" pattern="yyyy-MM-dd" mask="true"
				mode="popup" showOn="button" popupIconOnly="true" />

			<p:outputLabel value="供应商名称" />
			<p:inputText value="#{bmeWfmReceiptMB.io.supplier}" disabled="true" />
			<p:outputLabel value="收货地址" />
			<p:inputText value="#{bmeWfmReceiptMB.io.address}" disabled="true" />
			<p:outputLabel value="收货人" />
			<p:inputText value="#{bmeWfmReceiptMB.io.consignee}" disabled="true" />
			<p:outputLabel value="电话" />
			<p:inputText value="#{bmeWfmReceiptMB.io.phone}" disabled="true" />
			<p:outputLabel value="车牌号" />
			<p:inputText value="#{bmeWfmReceiptMB.io.lpn}" disabled="true" />
			<p:outputLabel value="司机及电话" />
			<p:inputText value="#{bmeWfmReceiptMB.io.driver}" disabled="true" />
			<p:outputLabel value="单据状态" />
			<p:selectOneMenu value="#{bmeWfmReceiptMB.io.status}" effect="fold" disabled="true"
				style="width:80%;" required="true">
				<f:selectItems value="#{bmeWfmReceiptMB.itemsStatus}" /> 
			</p:selectOneMenu>
			<p:outputLabel value="备注" />
			<p:inputText value="#{bmeWfmReceiptMB.io.remarks}" disabled="true" />
		</h:panelGrid>
	</p:panel>
	<p:panel id="bmeDetailPanel" header="发货单签收信息" style="margin-bottom:5px">
		<p:dataTable id="rdt" value="#{bmeWfmReceiptMB.vod}" var="row"
			rowIndexVar="rowNum" resizableColumns="true" liveResize="true"
			style="margin-bottom:5px" paginator="true"
			editable="true" 
			paginatorPosition="bottom" rows="8" emptyMessage="没有记录">
			
			<p:ajax event="rowEdit" listener="#{bmeWfmReceiptMB.onRowEdit}" 
				update=":dlgFrm:msgs" />
			<p:ajax event="rowEditCancel"	listener="#{bmeWfmReceiptMB.onRowCancel}"
				update=":dlgFrm:msgs" />

			<p:column headerText="No." width="20">
				#{rowNum+1}
			</p:column>
			<p:column headerText="物料编号" sortBy="#{row.bmeMaterial.id}"
				width="100">
				<h:outputText value="#{row.bmeMaterial.id}" />
			</p:column>
			<p:column headerText="物料描述" width="100">
				<h:outputText value="#{row.bmeMaterial.mdesc}" />
			</p:column>
			<p:column headerText="数量" width="60">
				<h:outputText value="#{row.mquantity}" />
			</p:column>
            <p:column headerText="数量片" width="60">
				<h:outputText value="#{row.processQuantity}"  />
            </p:column>			
			<p:column headerText="签收数量" width="80" style="color:red;">
				<p:cellEditor>
					<f:facet name="output">
						<h:outputText value="#{row.squantity}" style="color:red;"/>
					</f:facet>
					<f:facet name="input">
						<p:inputText value="#{row.squantity}" style="width:100%" />
					</f:facet>
				</p:cellEditor>
			</p:column>
			<p:column headerText="破损数量" width="80" style="color:red;">
				<p:cellEditor>
					<f:facet name="output">
						<h:outputText value="#{row.dquantity}" style="color:red;"/>
					</f:facet>
					<f:facet name="input">
						<p:inputText value="#{row.dquantity}" style="width:100%" />
					</f:facet>
				</p:cellEditor>
			</p:column>	
			<p:column headerText="丢失数量" width="80" style="color:red;">
				<p:cellEditor>
					<f:facet name="output">
						<h:outputText value="#{row.lquantity}" style="color:red;"/>
					</f:facet>
					<f:facet name="input">
						<p:inputText value="#{row.lquantity}" style="width:100%" />
					</f:facet>
				</p:cellEditor>
			</p:column>											
			<p:column headerText="备注" width="100">
				<h:outputText value="#{row.remarks}" />
			</p:column>
			<p:column style="width:32px">
				<p:rowEditor />
			</p:column>
		</p:dataTable>
	</p:panel>
		<p:commandButton value="确认签收数量" icon="ui-icon-check" 
        		process="@this"  oncomplete="PF('dlgWfmPurch').hide();"  update=":dlgFrm:msgs"
             	actionListener="#{bmeWfmReceiptMB.genSignAmount}"  >					
		</p:commandButton>
	</h:form>
	</p:dialog> 

</ui:composition>
